from django.db import models

class KnowledgeBaseVisit(models.Model):
    knowledge_base = models.CharField(max_length=255)  # e.g., NCS9000
    visit_count = models.PositiveIntegerField(default=0)
    client_type = models.CharField(max_length=50, choices=[('desktop', 'Desktop'), ('mobile', 'Mobile')])
    timestamp = models.DateField()  # Date of the visit

    name = 'kbVisit'


class APIAccessLog(models.Model):
    endpoint = models.CharField(max_length=255)
    accessed_at = models.DateTimeField(auto_now_add=True)
    ip_address = models.GenericIPAddressField()
    user_agent = models.CharField(max_length=255)
    name='APIAccessLog'


class Meta:
        db_table = "APIAccessLog"
        verbose_name=("APIAccessLog")
        verbose_name_plural=("APIAccessLogs")

def __str__(self):
        return f"{self.endpoint} accessed at {self.accessed_at}"
